package test2;

import parser.cfg;

public class Var {
	public String type;
	public String value;
	public boolean isVar;
	public Var(String type,String value,boolean isVar) {
		this.type=type;
		this.value=value;
		this.isVar=isVar;
	}
	public Var(boolean isVar) {
		this.type="null";
	}
	public Var(String type,boolean isVar) {
		this.type=type;
		this.isVar=isVar;
		if(type.equals("bool")) {
			value="false";
		}
	}
	public int getNumInt() {
		
		return Integer.parseInt(value);
	}
	public boolean isClass() {
		//System.out.println(type.substring(0, 5));
		if(type.length()>5&&type.substring(0, 5).equals("class")) {
			return true;
		}
		return false;
	}
	public int getClassType() {
		if(type.length()>2&&type.substring(type.length()-2,type.length()).equals("()")) {
			return cfg.CT_FUNC;
		}else {
			return cfg.CT_SX;
		}
	}
}
